package com.atguigu.springcloud.comtroller;

import com.atguigu.springcloud.domain.CommonResult;
import com.atguigu.springcloud.domain.Payment;
import com.atguigu.springcloud.server.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class OrderFeignController {
    @Autowired
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/addPayment")
    public CommonResult<Payment> addPayment(Payment payment){
        return paymentFeignService.addPayment(payment);
    }

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> findById(@PathVariable("id")int id){
        return paymentFeignService.findById(id);
    }

    @GetMapping("/consumer/payment/findAll")
    public CommonResult<Payment> findAll(){
        return paymentFeignService.findAll();
    }
}
